<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');



class Ajax extends MY_Controller {
    
    // Edit and Delete Client
   public function ir_edit_client()
    {
      
       $this->load->view('ajax/client/ir_edit_client');    
    }
    
    public function ir_delete_client()
    {
       $id = isset($_POST['id']) ? $_POST['id'] : die('ERROR 403: Forbidden');
       
       
       $this->load->model('model_client');
       $deleted = $this->model_client->delete_client(array('id'=>$id));
       
        if($deleted){
            
        $this->load->model('model_client');
        $all['clients'] = $this->model_client->get_all_clients();    
        $this->load->view('client/display_all_clients',$all);
        
        
        }
        else{
        echo "ERROR ON DELETE";
        }
    }
    
    
    // Edit and Delete Screen
    public function ir_edit_screen()
    {
       $this->load->view('ajax/screen/ir_edit_screen');    
    }
    
    public function ir_delete_screen()
    {
       $id = isset($_POST['id']) ? $_POST['id'] : die('ERROR 403: Forbidden');
       $this->load->model('model_screen');
       $deleted = $this->model_client->delete_screen(array('id'=>$id));
       
        if($deleted){
            
        $this->load->model('model_screen');
        $all['screens'] = $this->model_client->get_all_screens();    
        $this->load->view('screen/display_all_screens',$all);
        
        
        }
        else{
            echo "ERROR ON DELETE";
        }
    }
    
   
}